home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / comm / pmtl10.zip / tagline.cmd < prev    next >
OS/2 REXX Batch file  |  1996-09-22  |  3KB  |  103 lines

  1. /*  Tagline Exit Script for PMMail - Copyright 1996, Stephen Berg and IceBerg  */
  2. /*                                   Software Productions.                     */
  3.  
  4. Parse Arg targetfile
  5. '@echo off'
  6.  
  7. /*  First we load up the VRexx utilities so we can create and manipulate the   */
  8. /*  The pretty windows!!  =:-)                                                 */
  9. call RxFuncAdd 'Vinit', 'VREXX', 'VINIT'
  10. initcode = VInit()
  11.     if initcode = 'ERROR' then SIGNAL CLEANUP
  12.     signal on failure name CLEANUP
  13.     signal on halt name CLEANUP
  14.     signal on syntax name CLEANUP
  15.  
  16. /*  Now we create a small dialog to let the user pick how he/she wants the     */
  17. /*  tagline for the current message to be chosen.                              */
  18.  
  19. pick.0 = 4
  20. pick.1 = 'Let PMTagLine randomly pick a TagLine.'
  21. pick.2 = 'Pick one from the file specifically.'
  22. pick.3 = 'Input your own TagLine manually.'
  23. pick.4 = 'Bypass the TagLine insertion.'
  24. Call VRadioBox 'PMTagLine V 0.10', pick, 1
  25. choice = pick.vstring
  26.  
  27. /*  Take action according to the user's choice.                                */
  28. SELECT
  29. WHEN choice = pick.1 THEN
  30.     Call PickRandom
  31. WHEN choice = pick.2 THEN
  32.     Call PickOne
  33. WHEN choice = pick.3 THEN
  34.     CALL Insert
  35. WHEN choice = pick.4 THEN
  36.     CALL Cancel
  37. OTHERWISE 
  38.     Call VExit
  39. end
  40.  
  41. /*  Make sure that the message is closed before we exit.                       */
  42.     rc = LineOut(targetfile)
  43. exit
  44.  
  45. /*  Kill any remaining VREXX stuff.                                            */
  46. CLEANUP:
  47.     Say 'PMTagLine interrupted!!'
  48.     Call VExit
  49.  
  50. /*  For randomly picking taglines                                              */
  51. PickRandom:
  52.     Call GetTagArray
  53.     pick = RANDOM(1, tagline.0)
  54.     tag = tagline.pick
  55.     rc = LineOut(targetfile, 'PMTagLine - Copyright, 1996, Stephen Berg')
  56.     rc = LineOut(targetfile, '...' tag)
  57.     rc = LineOut(targetfile)
  58.     Call VExit
  59. return
  60.  
  61. /*  To let the user specifically pick one tagline from the taglines.txt       */
  62. /*  file                                                                      */
  63. PickOne:
  64.     Call GetTagArray
  65.     Call VListBox 'Pick a tagline', tagline, 60, 10, 1
  66.     tag = tagline.vstring
  67.     rc = LineOut(targetfile, 'PMTagLine - Copyright, 1996, Stephen Berg')
  68.     rc = LineOut(targetfile, '...' tag)
  69.     rc = LineOut(targetfile)
  70.     Call VExit
  71. return
  72.  
  73. /*  To let the user insert their own tagline                                   */
  74. Insert:
  75.     msg.0 = 3
  76.     msg.1 = 'Please input your own tagline'
  77.     msg.2 = 'in the window below.'
  78.     msg.3 = ''
  79.     msg.vstring = 'Insert witty remark here'
  80.     Call VInputBox 'PMTagLine V 0.10', msg, 60, 1
  81.     tag = msg.vstring
  82.     rc = LineOut(targetfile, 'PMTagLine - Copyright, 1996, Stephen Berg')
  83.     rc = LineOut(targetfile, '...' tag)
  84.     rc = LineOut(targetfile)
  85.     Call VExit
  86. return
  87.  
  88. /*  Load the tagline file into an array for either picking or random choice.   */
  89. GetTagArray:
  90.     cnt = 0
  91.     do While Lines('tagline.txt') > 0
  92.         cnt = cnt + 1
  93.         tagline.0 = cnt
  94.         tagline.cnt = LineIn('tagline.txt')
  95.     end
  96. return
  97.  
  98. /*  For no tagline functions to the current message.                           */
  99. Cancel:
  100.     Call VExit
  101. return
  102.  
  103.